package control;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBConnection {
    
    static final String USER = "root";
    static final String PASSWORD = "12345";
    static final String CONTROLLER = "com.mysql.jdbc.Driver";
    static final String DATABASE_URL = "jdbc:mysql://localhost/mydb";
    
    public static Connection establishConection(boolean autocommits) throws ClassNotFoundException, SQLException{
        Connection connection;
        Class.forName(CONTROLLER);
        connection = DriverManager.getConnection(DATABASE_URL, USER, PASSWORD);
        connection.setAutoCommit(autocommits);
        return connection;
    }
    
}
